﻿<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>在线咨询查看</title>
    <meta name="viewport" content="initial-scale=1, maximum-scale=1, user-scalable=no" />
    <link href="../Frozenui1.3/css/frozen.css" rel="stylesheet" />
    <link href="../CSS/fs_gallery.css" rel="stylesheet" />
    <script src="../JS/layer/layer.m.js"></script>
    <script src="../JS/zepto.min.js"></script>
    <script src="../Frozenui1.3/js/frozen.js"></script>
    <script src="../JS/avalon.mobile.min.js"></script>
    <script src="../JS/MobileCom.js?v=1.0002"></script>
    <!--<script src="../JS/Jquery2.1.js"></script>-->
    <script src="../JS/fs_gallery.js"></script>

    <script src="http://res.wx.qq.com/open/js/jweixin-1.0.0.js"></script>
    <script>
        document.addEventListener('WeixinJSBridgeReady', function onBridgeReady() {
            //隐藏右上角按钮
            WeixinJSBridge.call('hideOptionMenu');
        });

        var width = 0;
        var strId = MobileCom.getQueryString("ID");
        var gzrbinfo = avalon.define({
            $id: "gzrbinfo",
            modelData: {},
            plData: {},
            plcount: 0,
            nowuser: "",
            tpData: [],
            imgurl:'',
            hfData: { "Type": "1", "ZXID": strId, "HFContent": "", "Status": "0", "intProcessStanceid": "0","Files":"" },
            scpl: function (plel) {
                var tc = layer.open({
                    content: '确定要删除此评论吗？',
                    btn: ['确定', '取消'],
                    shadeClose: false,
                    yes: function () {
                        layer.close(tc);
                        var lg = $.loading({
                            content: '删除中...',
                        })
                        $.getJSON('/API/WXAPI.ashx?Action=DELTL&r=' + Math.random(), { P1: plel.ID }, function (resultData) {
                            lg.hide();
                            if (resultData.ErrorMsg == "") {
                                gzrbinfo.plData.remove(plel);
                                gzrbinfo.plcount = hdinfo.plcount - 1;
                                var el = $.tips({
                                    content: "删除成功",
                                    stayTime: 2000,
                                    type: "success"
                                })
                                el.on("tips:hide", function () {
                                    //window.location.reload();
                                })
                            }
                            else {
                                $.tips({
                                    content: "删除失败，原因：" + resultData.ErrorMsg,
                                    stayTime: 2000,
                                    type: "warn"
                                })
                            }
                        })
                    }, no: function () {
                    }
                })
            },
            hf: function () {
                //var tc = layer.open({
                //    type: 1,
                //    //title: "评论",
                //    content: '<div class="ui-form ui-border-t" style="width:' + (width - 76) + 'px;"><div class="ui-form-item ui-border-b" style="height:auto;min-height:44px;"><label style="width:50px">回复</label><textarea class="form-control" autofocus="autofocus" id="hf" placeholder="填写回复..." style="height:100px;margin-top:13px;padding-left: 50px;"></textarea></div><div class="ui-form-item ui-border-b"><label style="width:50px">图片</label><div style="padding-left: 50px;"><a class="ui-icon-add"></a></div></div></div>',
                //    btn: ['确认', '取消'],
                //    shadeClose: false,
                //    yes: function () {
                //        if ($("#hf").val() == null || $("#hf").val() == "") {
                            
                //            alert("请输入回复内容");
                //            return;
                //        }
                //        else {
                //            gzrbinfo.hfData.HFContent = $("#hf").val();
                //        }
                //        var lg = $.loading({
                //            content: '保存中...',
                //        })
                //        $.getJSON('/API/WXAPI.ashx?Action=ADDZXZXITEM&r=' + Math.random(), { "P1": JSON.stringify(gzrbinfo.hfData.$model) }, function (resultData) {
                //            lg.hide();
                //            if (resultData.ErrorMsg == "") {
                //                gzrbinfo.plData.push(resultData.Result);
                //                gzrbinfo.plcount = gzrbinfo.plcount + 1;
                //                var el = $.tips({
                //                    content: "回复成功！！",
                //                    stayTime: 2000,
                //                    type: "success"
                //                })
                //                $("#content").val("");
                //            }
                //            else {
                //                var el = $.tips({
                //                    content: "回复失败！！",
                //                    stayTime: 2000,
                //                    type: "warn"
                //                })
                //            }
                //        })

                //        layer.close(tc);

                //    }, no: function () {
                //    }
                //})

                MobileCom.showAnswer("360", function (nr, tp) {
                    var lg = $.loading({
                        content: '保存中...',
                    })
                    gzrbinfo.hfData.HFContent = nr;
                    //gzrbinfo.hfData.Files = tp;

                    $.getJSON('/API/WXAPI.ashx?Action=ADDZXZXITEM&r=' + Math.random(), { "P1": JSON.stringify(gzrbinfo.hfData.$model), "P2": tp }, function (resultData) {
                        lg.hide();
                        if (resultData.ErrorMsg == "") {
                            gzrbinfo.plData.push(resultData.Result[0]);
                            gzrbinfo.plcount = gzrbinfo.plcount + 1;
                            var el = $.tips({
                                content: "回复成功！！",
                                stayTime: 2000,
                                type: "success"
                            })
                            $(".fs_gallery").remove();
                            $('.mall_pcp').fsgallery();
                        }
                        else {
                            var el = $.tips({
                                content: "回复失败！！",
                                stayTime: 2000,
                                type: "warn"
                            })
                        }
                    })

                })
            },
            fdtp: function (obj) {
                if (!$(".fs_gallery").html()) {
                    $('.mall_pcp').fsgallery();
                    $(obj).trigger("click");
                }
            }
        });
        avalon.ready(function () {
            width = document.documentElement.clientWidth;
            if (strId != null) {
                var lg = $.loading({
                    content: '加载中...',
                })
                var n = 0;
                $.getJSON('/API/WXAPI.ashx?Action=GETZXZXMODEL&r=' + Math.random(), { P1: strId }, function (resultData) {
                    n = n + 1;
                    if (n == 2) {
                        lg.hide();
                    }
                    if (resultData.ErrorMsg == "") {
                        gzrbinfo.modelData = resultData.Result;
                        if (resultData.Result1) {
                            gzrbinfo.plData = resultData.Result1;
                            gzrbinfo.plcount = resultData.Result1.length;
                        }
                        if (resultData.Result2) {
                            gzrbinfo.tpData = resultData.Result2;
                        }
                    }
                })
                $.post("/API/SZHLAPI.ashx?Action=GetUserInfo&r=" + Math.random(), {}, function (data) {
                    n = n + 1;
                    if (n == 2) {
                        lg.hide();
                    }
                    var data = $.parseJSON(data);
                    if (data.ErrorMsg == "") {
                        if (data.Result.QYinfo.FileServerUrl) {
                            var str = data.Result.QYinfo.FileServerUrl;
                            if (str.substr(str.length - 1, 1) != "/") {
                                str = str + "/";
                            }
                            gzrbinfo.imgurl = str;
                        }
                    }
                })
            }
        })
        
        function issc(str) {
            if (str == gzrbinfo.nowuser) {
                return '<div class="ui-badge-corner" style=" position: relative; " ms-click="scpl(el)">删除</div>';
            }
            else {
                return '';
            }
        }

        function back() {
            window.location.replace("UI_ZXZX_LIST.html?Type=" + gzrbinfo.modelData.Type + "&r=" + Math.random());
        }

    </script>
    <style>
        .ui-list > li {
            margin: 3px;
            padding-left: 15px;
        }

        .ui-form-item .wspan {
            width: 100%;
            -webkit-box-sizing: border-box;
            box-sizing: border-box;
            -webkit-appearance: none;
            border: 0;
            background: 0 0;
            padding-left: 95px;
        }

        .ms-controller, [ms-controller] {
            display: none;
        }

        .ui-form-item .span img {
            height: auto !important;
            width: auto\9 !important;
            width: 100% !important;
        }
        .imgxl img {
            width: 50px;
            height: 50px;
            padding-right: 3px;
        }
        .sctp {
            color: #18b4ed;
            right: 4px;
            top: -5px;
            z-index: 9;
            width: 20px;
            height: 20px;
            background: #fff;
            border-radius: 13px;
            line-height: 20px;
            text-indent: -3px;
            position: absolute;
            font-size: 25px;
        }

        .imgxl {
            position: relative;
            float: left;
            padding-top: 0;
            height: 50px;
            width: 50px;
            padding-right: 10px;
            margin-left: 0px;
            margin-bottom: 5px;
        }

        .tpxs {
            height: 50px;
            width: 50px;
            position: absolute;
            top: 0;
            left: 0;
            z-index: 1;
            background-repeat: no-repeat;
            -webkit-background-size: cover;
        }
        .ui-form-item .span {
            line-height: 1.5 !important;
            padding-bottom: 10px;
            overflow: hidden;
            word-wrap: break-word;
        }
    </style>
</head>
<body ms-controller="gzrbinfo">
    <header class="ui-header ui-header-stable ui-border-b">
        <i class="ui-icon-return" onclick="back()"></i><h1>在线咨询查看</h1>
        <a class="ui-btn-lg ui-btn-primary" ms-click="hf()" style="float: right; width: auto; height: 30px; line-height: 30px; ">回复</a>
    </header>


    <section class="ui-container">

        <div class="ui-form ui-border-t">
            <div class="ui-form-item ui-border-b ">
                <label>
                    类型
                </label>
                <span class="wspan">{{modelData.Type}}</span>
            </div>
            <div class="ui-form-item ui-border-b" style="height:auto;min-height:44px">
                <label>
                    标题
                </label>
                <span ms-html="modelData.Title" class="wspan" style="overflow: hidden; word-wrap: break-word;"></span>
                <div style="clear: both"></div>
            </div>
            <div class="ui-form-item ui-border-b" style="height:auto;min-height:44px">
                <label>
                    详细内容
                </label>
                <span class="wspan "></span>
                <p class="span" ms-if="modelData.Description" ms-html="modelData.Description"></p>
                <div style="clear: both"></div>
            </div>
            <div class="ui-form-item ui-border-b" style="height:auto;min-height:44px" ms-if="tpData.size()>0">
                <label>
                    图片
                </label>
                <div class="wspan" style="padding-top:10px">
                    <span ms-repeat-fl="tpData">
                        <img ms-click="fdtp(this)" ms-if="MobileCom.xstp(fl.FileExtendName)" class="mall_pcp" ms-src="imgurl+'image/'+fl.FileMD5" style="width:60px;height:60px;padding-right: 5px;" />
                    </span>
                    <span ms-repeat-fls="tpData">
                        <img ms-click="fdtp(this)" ms-if="!MobileCom.xstp(fls.FileExtendName)" class="mall_pcp" ms-attr-src="'/MobileView/Images/qywd/'+fls.FileExtendName+'.png'" style="width:60px;height:60px;padding-right: 5px;" />
                    </span>
                </div>
            </div>
            <div class="ui-form-item ui-border-b">
                <label>
                    回复区
                </label>
                <span class="wspan">共 {{plcount}} 条回复</span>
                <!--<a class="ui-btn-lg ui-btn-primary" ms-click="hf()" style="float: right; width: auto; height: 30px; line-height: 30px; margin-top: 7px;">回复</a>-->
            </div>
            <div class="ui-form ui-border-t " style="margin-bottom:44px">
                <ul class="ui-list ui-list-pure">
                    <li class="ui-border ui-label-list" ms-repeat-el="plData">
                        <div style="display: -webkit-box;">
                            <div class="ui-avatar-s">
                                <span ms-css-background-image="url(/Upload/TX/{{el.CRUser}}.jpg)"></span>
                            </div>
                            <div class="ui-list-info">
                                <h4>{{el.CRUserName}}</h4>
                            </div>
                            <div class="ui-list-info">
                                <p>{{el.CRDate|date("yyyy-MM-dd HH:mm")}}</p>
                            </div>
                            <!--{{issc(el.CRUser)|html }}-->
                        </div>
                        <div ms-if="el.FileList"><img class="mall_pcp" ms-repeat-fl="el.FileList" ms-click="fdtp(this)" ms-src="imgurl+'image/'+fl.FileMD5" style="width:60px;height:60px;padding-right: 5px;" /></div>
                        <p class="ui-txt-justify" ms-html="el.HFContent" style="overflow: hidden; word-wrap: break-word;"></p>
                    </li>
                </ul>
            </div>
        </div>

        <!--<div class="ui-footer ui-footer-stable ui-btn-group ui-border-t">
            <section class="ui-input-wrap ui-border-t" style="width:100%">
                <div class="ui-input ui-border-radius">
                    <input id="content" type="text" name="" value="" placeholder="回复...">
                </div>
                <button class="ui-btn">回复</button>
            </section>
        </div>-->
    </section>
</body>
</html>
